package com.iotp.service.live;

import com.iotp.dao.live.LiveMapper;
import com.iotp.entity.live.Live;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("liveService")
public class LiveServiceImpl implements LiveService {

    @Autowired
    private LiveMapper liveMapper;

    @Override
    public Long add(Live live) {
        this.liveMapper.insert(live);
        return live.getId();
    }

    @Override
    public void edit(Live live) {
        this.liveMapper.updateByPrimaryKeySelective(live);
    }

    @Override
    public void delete(Long id) {
        this.liveMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Live queryById(Long id) {
        return this.liveMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Live> queryList(Live live) {
        return this.liveMapper.selectByCondition(live);
    }
}
